/**
  全局基础设置，包括 sidebar， navbar， tagbar， maincontainer 等样式
*/
@import '~@/styles/var.scss';
@import "~@/styles/mixin.scss";
// 禁止用户选中 鼠标变为手形
%unable-select {
  user-select: none;
  cursor: pointer;
}

.app-wrapper {
  @include clearfix-mixin;
  position: relative;
  height: fit-content;
  min-height: 100%;
  width: 100%;
  // 固定 header
  &.fixedHeader {
    height: 100%;
    .app-body {
      margin: 0;
      position: relative;
      padding: 0;
    }
  }

  .fixed-header {
    position: fixed;
    top: 0;
    right: 0;
    z-index: 9;
    width: calc(100% - #{$sidebar-width});
    transition: width 0.28s;
  }
  
}

// 主体
.main-container {
  background: linear-gradient(#2e444f, #252c39);
  height: 100%;
  transition: margin-left .28s;
  margin-left: $sidebar-width;
  // position: relative;
  z-index: 9;

  .page-view {
    padding: 2rem;
    overflow: hidden;
    margin: 0 30px 15px 30px;
  }
  &.main-topmenu {
    margin-left: 0;

    .fixed-header {
      width: 100%;
    }
  }
  // 所有输入框，按钮去圆角
  .el-button, .el-input__inner, .el-textarea__inner {
    font-size: $font-size-middle;
  }
  // 内容不能被选中
  .unSelect {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
  }
  // 操作被禁止
  .disabled-action {
    opacity: 0.6;
    &:hover {
      cursor: not-allowed;
    }
  }
}


// 导航栏（头部）
.navbar {
  height: $header-height;
  display: flex;
  justify-content: space-between;
  overflow: hidden;
  position: relative;
  &.navbar-topmenu {
    .right-menu {
      color: #fff;
    }
  }

  .left-menu {
    flex: 1;

    .hamburger-container {
      line-height: $header-height;
      height: 100%;
      float: left;
      cursor: pointer;
      transition: background .3s;

      &:hover {
        background: rgba(0, 0, 0, .025)
      }
    }

    .breadcrumb-container {
      float: left;
    }
  }

  .right-menu {
    display: flex;
    height: 100%;
    line-height: $header-height;

    &:focus {
      outline: none;
    }

    .right-menu-item {
      display: inline-block;
      padding: 0 8px;
      height: 100%;
      font-size: 18px;
      vertical-align: text-bottom;

      &.hover-effect {
        cursor: pointer;
        transition: background .3s;

        &:hover {
          background: rgba(0, 0, 0, .025)
        }
      }
    }

    .avatar-container {
      margin-right: 30px;

      .avatar-wrapper {
        margin-top: 5px;
        position: relative;

        .user-avatar {
          cursor: pointer;
          width: 40px;
          height: 40px;
          border-radius: 10px;
        }

        .el-icon-caret-bottom {
          cursor: pointer;
          position: absolute;
          right: -20px;
          top: 25px;
          font-size: 12px;
        }
      }
    }
  }
}


// 导航栏 logo
.sidebar-logo-container {
  position: relative;
  height: $header-height;
  line-height: $header-height;
  text-align: center;
  overflow: hidden;
  padding: 0 20px;
  border-bottom: 1px solid hsla(0,0%,100%,.1);

  a.sidebar-logo-link {
    height: 100%;
    .logo-group {
      width: 100%;
      height: 56px;
    }
    
    .logo-mini {
      margin-top: 5px;
      height: 36px;
      width: 36px;
    }
  }
  &.collapse {
    padding: 0;
    a.sidebar-logo-link {
      display: flex;
      align-items: center;
      justify-content: center;
    }
  }
}

// 顶部导航栏模式
.sidebar-topmenu {
  display: flex;

  .sidebar-logo-container {
    max-width: $sidebar-width;
  }

  .el-menu--horizontal {
    display: flex;
    overflow-x: scroll;

    .menu-wrapper {
      height: $header-height;
      .el-menu {
        border: none;
      }
      .el-submenu {
        height: 100%;
      }
      .el-submenu__title,
      .el-menu-item {
        height: 100%;
        border: none;
        padding: 0 40px 0 20px;
        .custom-icon {
          margin-right: 10px;
        }
        i.el-icon-menu {
          display: inline-block;
          width: 1rem;
          height: 1rem;
          margin-right: 10px;
        }
      }
    }
  }
}

// 侧边导航栏样式
.sidebar-container {
  transition: width 0.28s;
  width: $sidebar-width !important;
  height: 100%;
  position: fixed;
  font-size: 12px;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 10;
  overflow: hidden;

  .copyright {
    display: block;
    width: 100%;
    font-size: 12px;
    text-align: center;
    color: #fff;
    z-index: -1;
    span {
      position: absolute;
      bottom: 0;
      left: 0;
      text-align: center;
      width: 100%;
      padding: 10px 0;
    }
    img {
      width: 100%;
      transition: all 0.5s;
    }
  }

  // scroll bar
  .el-scrollbar {
    height: 100%;

    .scrollbar-wrapper {
      overflow-x: hidden !important;
    }
  
    .el-scrollbar__bar.is-vertical {
      right: 0px;
    }
    .is-horizontal {
      display: none;
    }

  }

  // reset element-ui css
  .horizontal-collapse-transition {
    transition: 0s width ease-in-out, 0s padding-left ease-in-out, 0s padding-right ease-in-out;
  }
  
  a {
    position: relative;
    width: 100%;
    overflow: hidden;
  }

  .custom-icon {
    margin-right: 10px;
  }
  i.el-icon-menu {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    margin-right: 10px;
  }

  .el-menu {
    border: none;
    height: 100%;
    width: 100% !important;
    
    .router-link-active::before {
      transform: scaleY(1);
      opacity: 1;
    }
    .el-menu-item, .el-submenu__title {
      display: flex;
      align-items: center;
      font-size: $font-size-small;
      height: $sidebar-item-height;
      line-height: $sidebar-item-height;
    }

    .el-submenu {
      .el-menu-item {
        position: relative;
        padding-left: 25px !important;
        color: #fff;
        margin-left: 20px;
        border-radius: 15px 0px 0px 15px;
      }
    }
  }
}
.el-menu--collapse .el-menu .el-submenu {
  min-width: $sidebar-width !important;
}

// 侧边栏 收起
.hideSidebar {
  .fixed-header {
    width: calc(100% - #{$sidebar-collapse-width})
  }
  .sidebar-container {
    width: $sidebar-collapse-width !important;
  }

  .main-container {
    margin-left: $sidebar-collapse-width;
  }

  .submenu-title-noDropdown {
    padding: 0 !important;
    position: relative;

    .el-tooltip {
      padding: 0 !important;
    }
  }

  // 收起时icon居中展示
  .el-menu-item, .el-submenu, .el-submenu__title {
    text-align: center;
    justify-content: center;
    .custom-icon {
      margin-right: 0;
    }
  }

  .el-submenu {
    overflow: hidden;

    &>.el-submenu__title {
      padding: 0 !important;

      .el-submenu__icon-arrow {
        display: none;
      }
    }
  }

  .el-menu--collapse {
    .el-submenu {
      &>.el-submenu__title {
        &>span {
          height: 0;
          width: 0;
          overflow: hidden;
          visibility: hidden;
          display: inline-block;
        }
      }
    }
  }
}


// mobile 样式展示
.mobile {
  .main-container {
    margin-left: 0px;
  }

  .drawer-bg {
    background: #000;
    opacity: 0.3;
    width: 100%;
    top: 0;
    height: 100%;
    position: absolute;
    z-index: 20;
  }
  .sidebar-container {
    z-index: 2001;
    background-color: #fff;
    transition: transform .28s;
    width: $sidebar-width !important;
  }

  &.hideSidebar {
    .fixed-header {
      width: 100%;
    }
    .sidebar-container {
      pointer-events: none;
      transition-duration: 0.3s;
      transform: translate3d(-$sidebar-width, 0, 0);
    }
  }
  &.openSidebar {
    position: fixed;
    top: 0;
    .fixed-header {
      width: 100%;
    }
  }
}

.withoutAnimation {

  .main-container,
  .sidebar-container {
    transition: none;
  }
}

// when menu collapsed
.el-menu--vertical {
  &>.el-menu {
    .custom-icon {
      margin-right: 16px;
    }
  }
  // the scroll bar appears when the subMenu is too long
  >.el-menu--popup {
    max-height: 100vh;
    overflow-y: auto;
    border-radius: 0;
    &::-webkit-scrollbar-track-piece {
      background: #d3dce6;
    }

    &::-webkit-scrollbar {
      width: 6px;
    }

    &::-webkit-scrollbar-thumb {
      background: #99a9bf;
      border-radius: 20px;
    }
  }
}

// 设置页面返回按钮样式
.newPageTitle {
  margin-bottom: 15px;
}
.backIcon {
  font-size: 18px;
  cursor: pointer;
  i {
    font-weight: 600;
  }
}

// 搜索fold样式
.filterStyle {
  margin-bottom: 10px;
  .filterClose {
    width: 80px !important;
  }
}
.dialog-box {
  padding: 3px 0px;
  .confirm-box {
    text-align: right;
  }
}
// vue-treeselect样式调整
.vue-treeselect__control {
  height: 32px !important;
  border-radius: 0 !important;
}
.vue-treeselect--focused:not(.vue-treeselect--open) .vue-treeselect__control {
  border-color: $primary-color !important;
  box-shadow: 0 0 0 0 rgba(255,255,255,0) !important;
}
// 表单 footer样式
.footer {
  text-align: center;
  margin-top: 40px;
}
// 提示框样式
.el-message-box {
  border-radius: 0 !important;
  box-shadow: none;
  border: none;
  .el-message-box__btns {
    height: 28px;
    text-align: center;
    .el-button {
      background-color: $white;
      min-width: 90px;
      height: 28px;
      line-height: 0;
      font-size: $font-size-middle !important;
      font-weight: normal !important;
    }
    
    .el-button:hover {
      border-color: $theme-color;
    }

    .el-button--primary {
      @include colorBtn($bg-dark-color);
      border: 1px solid $bg-dark-color;
      color: $white;
    }

    .el-button--primary:hover {
      color: #fe8466;
      background: #fff;
    }
  }
}